package com.party.core.service.analysis.impl;

import com.party.common.paging.Page;
import com.party.core.dao.read.analysis.StatisticsFunnelReadDao;
import com.party.core.dao.write.analysis.StatisticsFunnelWriteDao;
import com.party.core.model.BaseModel;
import com.party.core.model.analysis.StatisticsFunnel;
import com.party.core.service.analysis.IStatisticsFunnelService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.Date;
import java.util.List;
import java.util.Map;
import java.util.Set;

/**
 * @program: party-temp
 * @description: 统计漏斗接口实现
 * @author: Huaqunhao
 * @create: 2018-08-01 11:58
 **/

@Service
public class StatisticsFunnelService implements IStatisticsFunnelService {

    @Autowired
    private StatisticsFunnelReadDao statisticsFunnelReadDao;

    @Autowired
    private StatisticsFunnelWriteDao statisticsFunnelWriteDao;

    @Override
    public String insert(StatisticsFunnel statisticsFunnel) {
        BaseModel.preInsert(statisticsFunnel);
        boolean result = statisticsFunnelWriteDao.insert(statisticsFunnel);
        if (result) {
            return statisticsFunnel.getId();
        }
        return null;
    }

    @Override
    public boolean update(StatisticsFunnel statisticsFunnel) {
        statisticsFunnel.setUpdateDate(new Date());
        return statisticsFunnelWriteDao.update(statisticsFunnel);
    }

    @Override
    public boolean deleteLogic(String id) {
        return false;
    }

    @Override
    public boolean delete(String id) {
        return statisticsFunnelWriteDao.delete(id);
    }

    @Override
    public boolean batchDeleteLogic(Set<String> ids) {
        return false;
    }

    @Override
    public boolean batchDelete(Set<String> ids) {
        return false;
    }

    @Override
    public StatisticsFunnel get(String id) {
        return statisticsFunnelReadDao.get(id);
    }

    @Override
    public List<StatisticsFunnel> listPage(StatisticsFunnel statisticsFunnel, Page page) {
        return statisticsFunnelReadDao.listPage(statisticsFunnel, page);
    }

    @Override
    public List<StatisticsFunnel> list(StatisticsFunnel statisticsFunnel) {
        return statisticsFunnelReadDao.listPage(statisticsFunnel, null);
    }

    @Override
    public List<StatisticsFunnel> batchList(Set<String> ids, StatisticsFunnel statisticsFunnel, Page page) {
        return null;
    }

    @Override
    public List<StatisticsFunnel> webListPage(StatisticsFunnel funnel, Map<String, Object> params, Page page) {
        return statisticsFunnelReadDao.webListPage(funnel, params, page);
    }
}
